package com.qt.pojo.vo;

import com.qt.pojo.base.BaseVO;
import com.qt.pojo.entity.problem.Tag;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author pgw
 * @version 1.0
 * @description
 * @date Create by 2023/9/23 21:07
 */
@Data
public class ProblemVO  extends BaseVO {
    @ApiModelProperty(value = "题目id")
    private Long id;

    @ApiModelProperty(value = "题目展示id")
    private String displayProblemId;

    @ApiModelProperty(value = "题目标题")
    private String title;

    @ApiModelProperty(value = "题目难度")
    private Integer difficulty;

    @ApiModelProperty(value = "题目类型")
    private Integer type;

    @ApiModelProperty(value = "题目标签")
    private List<Tag> tags;

    // 以下为题目做题情况

    @ApiModelProperty(value = "该题总提交数")
    private Integer total = 0;

    @ApiModelProperty(value = "通过提交数")
    private Integer ac = 0;

    @ApiModelProperty(value = "空间超限提交数")
    private Integer mle = 0;

    @ApiModelProperty(value = "时间超限提交数")
    private Integer tle = 0;

    @ApiModelProperty(value = "运行错误提交数")
    private Integer re = 0;

    @ApiModelProperty(value = "格式错误提交数")
    private Integer pe = 0;

    @ApiModelProperty(value = "编译错误提交数")
    private Integer ce = 0;

    @ApiModelProperty(value = "答案错误提交数")
    private Integer wa = 0;

    @ApiModelProperty(value = "系统错误提交数")
    private Integer se = 0;

    @ApiModelProperty(value = "该IO题目分数总和")
    private Integer pa = 0;

    @ApiModelProperty(value = "IO题目总分数")
    private Integer score;


    public void setProblemResultVo(JudgeProblemResultVO judgeProblemResultVO) {
        this.total = judgeProblemResultVO.getTotal() == null ? 0 :judgeProblemResultVO.getTotal();
        this.ac = judgeProblemResultVO.getAc() == null ? 0 : judgeProblemResultVO.getAc();
        this.mle = judgeProblemResultVO.getMle() == null ? 0 : judgeProblemResultVO.getMle();
        this.tle = judgeProblemResultVO.getTle() == null ? 0 : judgeProblemResultVO.getTle();
        this.re = judgeProblemResultVO.getRe() == null ? 0 : judgeProblemResultVO.getRe();
        this.pe = judgeProblemResultVO.getPe() == null ? 0 : judgeProblemResultVO.getPe();
        this.ce = judgeProblemResultVO.getCe() == null ? 0 : judgeProblemResultVO.getCe();
        this.wa = judgeProblemResultVO.getWa() == null ? 0 : judgeProblemResultVO.getWa();
        this.se = judgeProblemResultVO.getSe() == null ? 0 : judgeProblemResultVO.getSe();
        this.pa = judgeProblemResultVO.getPa() == null ? 0 : judgeProblemResultVO.getPa();
    }

}
